<template>
    <div class="mc-id-to-name">
    {{name}}
    </div>
</template>
<script>
    import {AjaxByAll} from '@/api/api'
    export default {
        data() {
            return {
                name: null,


            }
        },
        methods: {
            getUserName() {
                // alert(this.userId);
                if (this.id) {

                //通过用户id查找用户名称
                AjaxByAll('get', this.url+'?id=' + this.id, null).then(data => {

                    if (data.code === 200) {
                        this.name = data.data
                    }
                });
            }
            }


        },
        watch: {

        },
        mounted: function () {

            this.getUserName();

        },
        props: {
            id: String,
            url:String
        }
    }
</script>

<style>

</style>
